﻿
namespace Aeon.Emulator.Instructions.FPU
{
    internal static class Fxch
    {
        [Opcode("D9C8", OperandSize = 16 | 32, AddressSize = 16 | 32)]
        public static void Exchange0(VirtualMachine vm)
        {
        }

        [Opcode("D9C9", OperandSize = 16 | 32, AddressSize = 16 | 32)]
        public static void Exchange1(VirtualMachine vm)
        {
            double temp = vm.Processor.FPU.ST0;
            vm.Processor.FPU.ST0 = vm.Processor.FPU.GetRegisterValue(1);
            vm.Processor.FPU.SetRegisterValue(1, temp);
        }

        [Opcode("D9CA", OperandSize = 16 | 32, AddressSize = 16 | 32)]
        public static void Exchange2(VirtualMachine vm)
        {
            double temp = vm.Processor.FPU.ST0;
            vm.Processor.FPU.ST0 = vm.Processor.FPU.GetRegisterValue(2);
            vm.Processor.FPU.SetRegisterValue(2, temp);
        }

        [Opcode("D9CB", OperandSize = 16 | 32, AddressSize = 16 | 32)]
        public static void Exchange3(VirtualMachine vm)
        {
            double temp = vm.Processor.FPU.ST0;
            vm.Processor.FPU.ST0 = vm.Processor.FPU.GetRegisterValue(3);
            vm.Processor.FPU.SetRegisterValue(3, temp);
        }

        [Opcode("D9CC", OperandSize = 16 | 32, AddressSize = 16 | 32)]
        public static void Exchange4(VirtualMachine vm)
        {
            double temp = vm.Processor.FPU.ST0;
            vm.Processor.FPU.ST0 = vm.Processor.FPU.GetRegisterValue(4);
            vm.Processor.FPU.SetRegisterValue(4, temp);
        }

        [Opcode("D9CD", OperandSize = 16 | 32, AddressSize = 16 | 32)]
        public static void Exchange5(VirtualMachine vm)
        {
            double temp = vm.Processor.FPU.ST0;
            vm.Processor.FPU.ST0 = vm.Processor.FPU.GetRegisterValue(5);
            vm.Processor.FPU.SetRegisterValue(5, temp);
        }

        [Opcode("D9CE", OperandSize = 16 | 32, AddressSize = 16 | 32)]
        public static void Exchange6(VirtualMachine vm)
        {
            double temp = vm.Processor.FPU.ST0;
            vm.Processor.FPU.ST0 = vm.Processor.FPU.GetRegisterValue(6);
            vm.Processor.FPU.SetRegisterValue(6, temp);
        }

        [Opcode("D9CF", OperandSize = 16 | 32, AddressSize = 16 | 32)]
        public static void Exchange7(VirtualMachine vm)
        {
            double temp = vm.Processor.FPU.ST0;
            vm.Processor.FPU.ST0 = vm.Processor.FPU.GetRegisterValue(7);
            vm.Processor.FPU.SetRegisterValue(7, temp);
        }
    }
}
